<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
$credit_types=credit_types(true);
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('areasetting',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'代理中心','icon'=>'icon-shouye','action'=>'jy_storeping/store.area.index/'),
		array('title'=>'分红','icon'=>'icon-yiban','action'=>'jy_storeping/store.area.myfee/'),
		array('title'=>'区域订单','icon'=>'icon-dingdan','action'=>'jy_storeping/store.area.order/'),
		array('title'=>'代理地区','icon'=>'icon-paihao0','action'=>'jy_storeping/store.area.area/'),
	);	
	$return['item']=$this->plugin_setting('areasetting');
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$return['feetotal_types']=$this->feetotal_types;
	$return['fenxiaototal_types']=$this->fenxiaototal_types;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'tip','title'=>'[温馨提示]：代理分润：采用级差分润法！'),
					array('type'=>'radio','title'=>'成为代理商条件','name'=>'become','options'=>'become'),
					array('type'=>'string','title'=>'省级代理分润','name'=>'fee_1','help'=>'填写数字表示实际佣金金额，填写百分数表示比例。例如填写1表示发放1元佣金，填写1%表示发放商品价格1%的佣金'),
					array('type'=>'string','title'=>'市级代理分润','name'=>'fee_2','help'=>'填写数字表示实际佣金金额，填写百分数表示比例。例如填写1表示发放1元佣金，填写1%表示发放商品价格1%的佣金'),
					array('type'=>'string','title'=>'区级代理分润','name'=>'fee_3','help'=>'填写数字表示实际佣金金额，填写百分数表示比例。例如填写1表示发放1元佣金，填写1%表示发放商品价格1%的佣金'),
					array('type'=>'string','title'=>'社区代理分润','name'=>'fee_4','help'=>'填写数字表示实际佣金金额，填写百分数表示比例。例如填写1表示发放1元佣金，填写1%表示发放商品价格1%的佣金'),
				)
			),
			array(
						'title'=>'佣金计算',
						'list'=>array(
							array('type'=>'radio','title'=>'收益转比方式','name'=>'fee_totype','options'=>'fee_totype'),
							array('type'=>'string_two','unit1'=>'%','title1'=>'（N%）转为佣金'.$this->credit5,'unit2'=>'%','title2'=>'（N%）转'.$credit_types[5],'title'=>'收益转比','name1'=>'fee_tofee','name2'=>'fee_tobi5','show'=>array('fee_totype'=>1)),
							array('type'=>'string_two','unit1'=>'%','title1'=>'（N%）转为积分'.$this->credit5,'unit2'=>'%','title2'=>'（N%）转'.$credit_types[5],'title'=>'收益转比','name1'=>'fee_tobi1','name2'=>'fee_tobi5','show'=>array('fee_totype'=>2)),
							array('type'=>'radio','title'=>'佣金计算方式','name'=>'fee_pricetype','options'=>'commissiontype','help'=>'第一种：按商品实际成交价×百分比；第二种：按商品利润：【实际成交价-成本】×百分比；'),
							array('type'=>'checkbox','title'=>'不支持计算佣金支付方式','name'=>'fee_paytype','options'=>'credit_type','help'=>'说明：举例勾选抵扣券不支持分红；那么使用实际现金支付将减去抵扣券的额度不计算分红；'),
							array('type'=>'title','title'=>'佣金结算提现设置'),
							array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
							array('type'=>'unitstring','unit'=>'元','title'=>'结算额度（元）','name'=>'balance_money','help'=>'佣金达到该数值才能结算'),
							array('type'=>'unitstring','title'=>'佣金结算扣除服务费（%）','unit'=>'%','name'=>'balance_per'),
							array('type'=>'switch','title'=>'下单即可结算？','isradio'=>1,'name'=>'isbuy_jiesuan','help'=>'不开启，则表示，必须完成订单才能结算！'),
							array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，佣金才能申请提现,设置0或空，订单完成就可以结算'),
						)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		)
	);
	$return['fee_totype']=array('0'=>'不转比','1'=>'转比方式1','2'=>'转比方式2');
	$return['leveltype']=$this->level_up_types;
	$return['agent_types']=$this->agent_types;
	$return['commissiontype']=$this->commission_types;
	$return['become']=array('1'=>'后台指定','2'=>'申请');
	$return['area_level']=$this->area_level;
	$return['gift_type']=$this->gift_type;
	$return['credit_type']=$this->credit_type;
	$return['withdraw']=$this->pay_types;
	$return['htmls']=$htmls;
	exi($return);
}


